package com.xishu.entity.shop;

import com.xishu.annotation.valid.UniqueName;
import com.xishu.entity.AbstractEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.Entity;
import javax.persistence.Table;
import java.io.Serializable;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class Position extends AbstractEntity implements Serializable {

    private static final long serialVersionUID = 8327863878275150951L;

    @ApiModelProperty("shop名")
    private String shopName;

    @ApiModelProperty("shopId")
    @UniqueName
    private Long shopId;

    @ApiModelProperty("companyId")
    private Long companyId;

    @ApiModelProperty("距离")
    private double distance;

    @ApiModelProperty("地点信息")
    private String address;

    @ApiModelProperty(value = "纬度")
    private double latitude;

    @ApiModelProperty(value = "经度")
    private double longitude;

    public Position(String name, double distance, double longitude, double latitude) {
        this.shopName = name;
        this.distance = distance;
        this.latitude = latitude;
        this.longitude = longitude;
    }


    @Override
    public String toString() {
        return "Position{" +
                "shopName='" + shopName + '\'' +
                ", shopId=" + shopId +
                ", companyId=" + companyId +
                ", distance=" + String.format("%.2f", distance) + "km" +
                ", address='" + address + '\'' +
                ", latitude=" + latitude +
                ", longitude=" + longitude +
                '}';
    }
}
